package com.itheima.stock.task.timer;

import com.itheima.stock.task.StockTimerTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//定义股票任务bean
@Component
@Slf4j
public class StockTimerTask {

    @Autowired
    private StockTimerTaskService stockTimerTaskService;


    @XxlJob("testXxlJobTask")
    public void testXxlJobTask() {
        log.info("当前时间点:{}", DateTime.now().toString(DateTimeFormat.forPattern("yyyyMMddHHmmss")));
    }

    //定时采集国内大盘数据
    @XxlJob("getInnerMarketInfos")
    public void getInnerMarketInfos(){
        stockTimerTaskService.getInnerMarketInfo();
    }

    @XxlJob("getStockInfos")
    public void getStockInfos(){
        stockTimerTaskService.getStockRtIndex();
    }
}
